package myky.com.doctorapp.utils;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

/**
 * Created by xiangyao on 2018/8/1.
 */

public class NerWorkUtilss {
    /**
     * 当前有无网络
     *
     * @return
     */
  public   static Boolean isNetWorkAvailable(Context context) {
        ConnectivityManager connectivityManager = (ConnectivityManager) context.getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo info = connectivityManager.getActiveNetworkInfo();
        if (info == null) {
            return false;
        } else {
            if (info.isAvailable()) {
                return true;
            }
        }
        return false;
    }
}
